<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
<script src="./js/axios.min.js"></script>
    <script>
	//发送post请求默认给后台传递的是json 数据格式的参数
	axios.post('http://localhost:3000/axios',{
		uname:'Tom',
		pwd:123456
		}).then((data)=>{
		const {data:res}=data
		console.log(res)
	})
	
	//发送put请求
	axios.put('http://localhost:3000/axios/1',{
		uname:'Tom',
		pwd:123456
		}).then((data)=>{
		const {data:res}=data
		console.log(res)
	})
	
	//URLSearchParams传递 字符串形式的数据 
	let params=new URLSearchParams()
	params.append('uname','JERRY')
	params.append('pwd',4567899)
	axios.post('http://localhost:3000/axios',params).then((data)=>{
		const {data:res}=data
		console.log(res)
	})
    </script>	
</body>

</html>